<?php include_once 'index.php'?>
<!DOCTYPE html>
<html>
<head>
<?php include "inc/head.php" ?>
<script>
function onSub(){					   
	if($("input[name=username]").val()==""){	
		alert("姓名不能为空!");
		return false;
	}	
	var telphone = $.trim($('input[name=tel]').val());
	if(telphone==""){	
		alert("电话不能为空!");
		return false;
	}	
	if(telphone){
		var tel=$("input[name=tel]").val();
		var p1 = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;
		var me = false;
		var reg0 = /^13\d{5,9}$/;
		var reg1 = /^153\d{4,8}$/;
		var reg2 = /^159\d{4,8}$/;
		var reg3 = /^15\d{5,9}$/;
		var reg4 = /^18\d{5,9}$/;
		var reg5 = /^0\d{10,11}$/;
		var my = false;
		if (p1.test(tel))me=true;
		if (reg0.test(tel))my=true;
		if (reg1.test(tel))my=true;
		if (reg2.test(tel))my=true;
		if (reg3.test(tel))my=true;
		if (reg4.test(tel))my=true;
		if (reg5.test(tel))my=true;
		if (!my && !me){
			alert('联系电话格式错误，请您输入正确的格式，比如:13456789101 or 0571-12345678"');
			return false;
		}
	}
	
	if($("input[name=fax]").val()==""){	
		alert("传真不能为空!");
		return false;
	}	
	
	var email = $.trim($('input[name=email]').val());
	if(email==""){	
		alert("电子邮箱不能为空!");
		return false;
	}
	if(email){
		var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; //验证邮箱的正则表达式
		if(!reg.test(email)){
			alert("邮箱格式不正确，请您重新输入");
			return false;
		}
	}
	
	if($("input[name=captcha]").val()==""){	
		alert("验证码不能为空!");
		return false;
	}	
}
function change_captcha(){
	document.getElementById("captcha_pic").src="<?php echo site_url('captcha/index'); ?>/"+parseInt(Math.random()*1000);
	document.getElementById("captcha").focus();
}
</script>
<body>
<?php include "inc/swf_about.php" ?>
<article class="body_about">
	<article class="box_about clearfix">
		<?php include "inc/left.php" ?>
		<section class="rightbox">
			<div class="righttitle clearfix">
				<?php include'inc/path.php'?>
			</div>
			<div class="rightcont">
				<table width="100%">
				 <?=validation_errors('<p style="color:red;font-weight:bold;line-height:18px;text-align:center;">','</p>')?>
                 <form action="feedback.php?post/<?php echo $kind_id?>" method="post" onsubmit="return onSub()" >
                 <tr>
                  <td colspan="4">留言咨询/投诉建议</td>
                 </tr>
                 <tr>
                  <td width="10%">姓&nbsp;&nbsp;&nbsp;&nbsp;名：</td>
                  <td width="40%"><?=form_new_input('username','','class="text"')?></td>
                  <td width="10%">地&nbsp;&nbsp;&nbsp;&nbsp;址：</td>
                  <td width="40%"><?=form_new_input('addr','','class="text"')?></td>
                 </tr>
                 <tr>
                  <td width="10%">电&nbsp;&nbsp;&nbsp;&nbsp;话：</td>
                  <td width="40%"><?=form_new_input('tel','','class="text"')?> *</td>
                  <td width="10%">传&nbsp;&nbsp;&nbsp;&nbsp;真：</td>
                  <td width="40%"><?=form_new_input('fax','','class="text"')?> *</td>
                 </tr>
                 <tr>
                  <td width="10%">电子邮箱：</td>
                  <td width="90%"  colspan="3"><?=form_new_input('email','','class="text"')?> *</td>
                 </tr>
                 <tr>
                  <td width="10%" valign="top">留&nbsp;&nbsp;&nbsp;&nbsp;言：</td>
                  <td width="90%"  colspan="3"><textarea name="content" id="content"></textarea></td>
                 </tr>
                 <tr>
                  <td width="10%" valign="top"></td>
                  <td width="90%"  colspan="3"></td>
                 </tr>
            	<tr>
                  <td width="10%" valign="top">验证码：</td>
                  <td width="90%"  colspan="3">
                 	  <a href="javascript:change_captcha();"><img id="captcha_pic" src="<?php echo site_url('captcha/index/'.rand(1,999))?>" align="absmiddle" /></a>&nbsp;
					  <input type="text" maxlength="4" name="captcha" id="captcha" autocomplete="off" /></td>
                 </tr>
                 <tr>
                  <td width="10%" valign="top">&nbsp;</td>
                  <td width="90%"  colspan="3"><input type="submit" value="提交" class="submit" /><input type="reset" value="重写" class="submit"  /></td>
                 </tr>
                 </form>
                </table>
			</div>
		</section>
	</article>
	
	<?php include "inc/foot_about.php" ?>
</article>
</body>
</html>